package com.wwy.order.controller;


import com.common.domain.CommonResult;
import com.common.domain.PageResult;
import com.wwy.order.domain.vo.QueryOrderPageReq;
import com.wwy.order.domain.vo.ReportOrderCreateVo;
import com.wwy.order.domain.vo.ReportOrderRespVo;
import com.wwy.order.service.ReportOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;

import static com.common.domain.CommonResult.success;


/**
 * @author 王伟羽
 * @program: shuiwunew
 * @description: 订单
 * @create: 2024/12/12
 */
@RestController
@RequestMapping(value = "/order")
@Api(tags = {"报告订单"})
@Slf4j
public class OrderController {


    @Resource
    private ReportOrderService reportOrderService;



    @PostMapping(value = "/createOrder")
    @ApiOperation(value = "创建订单")
    public CommonResult createOrder(@RequestBody ReportOrderCreateVo createVo){
        return success(reportOrderService.createReportOrder(createVo));
    }


    @GetMapping(value = "/selectByOrderNumber")
    @ApiOperation(value = "根据订单号查询订单信息")
    public CommonResult<ReportOrderRespVo> selectByOrderNumber(@RequestParam("orderNumber") String orderNumber){
        return success(reportOrderService.selectByOddNum(orderNumber));
    }


    @PostMapping(value = "/selectPage")
    @ApiOperation(value = "分页查询")
    public CommonResult<PageResult<ReportOrderRespVo>> selectPage(@RequestBody QueryOrderPageReq pageReq){
        return success(reportOrderService.selectPage(pageReq));
    }



}
